/*
 * Copyright (c) 2023 Cshoo Org. All Rights Reserved.
 */

package org.cshoo.tattoo.embed.domain.feign;

import feign.Response;
import org.cshoo.tattoo.embed.domain.feign.dto.QuerySingleConfigResp;
import org.cshoo.tattoo.embed.domain.feign.dto.QuerySingleLookupResp;
import org.cshoo.tattoo.embed.domain.feign.dto.QuerySingleMessageResp;
import org.cshoo.tattoo.embed.domain.feign.dto.QueryTemplateResp;
import org.cshoo.tattoo.embed.domain.feign.factory.DataCenterFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author 杨翼
 * @since 1.0
 */
@FeignClient(value = "datacenter", qualifiers = {"dataCenterFeign"}, fallbackFactory = DataCenterFeignFallbackFactory.class)
public interface DataCenterFeign {

    /**
     * 查询单个config
     *
     * @param code 编号
     * @return config响应对象
     */
    @GetMapping(value = "/datacenter/config/querySingleConfig/{code}")
    QuerySingleConfigResp querySingleConfig(@PathVariable("code") String code) throws Exception;

    /**
     * 查询单个lookup
     *
     * @param code 编号
     * @return lookup信息
     */
    @GetMapping(value = "/datacenter/lookup/querySingleLookup/{code}")
    QuerySingleLookupResp querySingleLookup(@PathVariable("code") String code) throws Exception;

    /**
     * 查询单个message
     *
     * @param code 编号
     * @return message信息
     */
    @GetMapping(value = "/datacenter/message/querySingleMessage/{code}")
    QuerySingleMessageResp querySingleMessage(@PathVariable("code") String code) throws Exception;

    /**
     * 查询单个template
     *
     * @param code 编号
     * @return template信息
     */
    @GetMapping(value = "/datacenter/template/querySingleTemplate/{code}")
    QueryTemplateResp querySingleTemplate(@PathVariable("code") String code) throws Exception;

    /**
     * 下载模板文件
     *
     * @param fileStoreName 文件存储名称
     * @return 模板文件输入流
     */
    @GetMapping(value = "/datacenter/template/downloadTemplateFile/{fileStoreName}")
    Response downloadTemplateFile(@PathVariable("fileStoreName") String fileStoreName) throws Exception;
}
